package com.djhu.springsimple.beans.factory;

import com.djhu.springsimple.beans.core.BeanReference;

/**
 * @author by zw on 2018/4/16.
 */
public class RuntimeBeanNameReference implements BeanReference {
    private String beanName;
    private Object source;

    public RuntimeBeanNameReference(String beanName) {
        if (beanName == null || beanName.length()<0){
            throw new RuntimeException("RuntimeBeanNameReference bean name must not be empty!!!");
        }
        this.beanName = beanName;
    }

    public RuntimeBeanNameReference(String beanName, Object source) {
        if (beanName == null || beanName.length()<0){
            throw new RuntimeException("RuntimeBeanNameReference bean name must not be empty!!!");
        }
        this.beanName = beanName;
        this.source = source;
    }

    @Override
    public String getBeanName() {
        return beanName;
    }

    @Override
    public Object getSource() {
        return source;
    }
}